import {
	mapState,
	mapMutations
} from 'vuex'
export default {

	install(Vue) {
		Vue.mixin({
			data() {
				return {

				}
			},
			computed: {
				...mapState(["userInfo"])
			},
			methods: {
				...mapMutations(['updetaUserInfo']),
				//判断登录状态
				checkedisLogin() {

					//获取用户信息
					return new Promise(resolve => {

						if (this.userInfo) {
							resolve()
						} else {
							//提示消息
							uni.showToast({
								title: "需要登录后才能进行操作，请登录",
								icon: "none"
							})
							//跳转到登录界面
							uni.navigateTo({
								url: "/pages/userInfo/login/login"
							})
						}
					})
				},

			}
		})
	}
}
